from selenium.webdriver.support.wait import WebDriverWait
from appium.webdriver.common.appiumby import By

class PlaceOrder:
    def place_order(self, driver, message):
        # 备注
        WebDriverWait(driver, 10).until(lambda x: x.find_element(By.XPATH, "//*[@text='选填:对本次交易说明']")).click()
        WebDriverWait(driver, 10).until(lambda x: x.find_element(By.ID, "com.tpshop.malls:id/value_et")).send_keys(message)
        WebDriverWait(driver, 10).until(lambda x: x.find_element(By.ID, "com.tpshop.malls:id/ok_btn")).click()
        WebDriverWait(driver, 10).until(lambda x: x.find_element(By.ID, "com.tpshop.malls:id/submit_tv")).click()